<?php
/**
* 对 CGridView 继承
*	application.components.GridView
*/
Yii::import('zii.widgets.grid.CGridView');

class GridView extends CGridView{
 
	/**
	* 重写 __construct 函数，该函数早于init函数，改变cssFile路径
	*/ 
	function __construct(){
		parent::__construct();
		$this->cssFile = $this->controller->gridview; 
		$this->pager = array(
			'cssFile'=>$this->controller->pagerCssFile,
			'header'=>false,
			 
		);
		//支持左右键 翻页
	 	Yii::app()->getClientScript()->registerScript('keydownPage','
	 		var parentLink = $(\'.yiiPager .selected\').prev(\'li\').find(\'a\').attr(\'href\');
	 		var nextLink = $(\'.yiiPager .selected\').next(\'li\').find(\'a\').attr(\'href\');
	 		$("body").live("keydown", function(evt) {
	 			switch (evt.which) {
	 				case 37: //左( 	 				 
                    window.location.href= parentLink;
                    break;
                case 39: //右( 
                    window.location.href= nextLink;
                    break;
                default:
                    return;
				}
	 			
			});
	 	');
	}

}